{% extends "blog-base.html" %}

{% block main_content %}
<div class="blog">
  <div class="title-detail">
    <h3>{{ blog.title }}</h3>
  </div>
  <div class="desc">
    <ul>
      <li class="date">{{ blog.pub_time|default:"未知" }}</li>
    </ul>
    <p>{{ comments|length }}条评论</p>
  </div>
  <div class="post">
    {{ blog.content|safe }}
  </div>
</div>
<div id="comments">
  <ol>
    {% for comment  in comments %}
    <li class="comment">
      <h4>
        <span>{{ comment.author_name|default:"不详" }}</span>
        <span>邮箱{{ comment.author_email|default:"" }}</span>
        <span>发表：{{ comment.comment_id }}</span>
      </h4>
      <p>{{ comment.content|safe }}</p>
    </li>  
    {% endfor %}
  </ol>
</div>
<div id="post-comment">
  <form method="post" action="/blog/id/{{ blog.blog_id }}">
    {% csrf_token %}
    {{ form.as_p }}
    <p>
      <input type="submit" value="提交" />
    </p>
  </form>
</div>
{% endblock %}
